<template>
  <div>
    <p>当前房产经纪名称：{{agentName}}</p>
    <p v-if="agentList.length===0">暂无该房产经纪数据</p>
    <house-item v-for="item in agentList" :house="item" :key="item.id"></house-item>
  </div>
</template>

<script>
import { houseList } from '@/api/house'
export default {
  name: 'HouseIndex',
  props: ['agentId', 'agentName'],
  data () {
    return {
      agentList: []
    }
  },
  created () {
    // console.log(this.$route)
    this.getagentList()
  },
  mounted () {

  },

  methods: {
    async getagentList () {
      try {
        const res = await houseList({
          _limit: 10,
          agent: this.agentId
        })
        console.log(res)
        this.agentList = res
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
